<?php
/*
 * @Date: 2024-04-12 20:09:44
 * @LastEditTime: 2024-04-12 20:10:30
 * 
 */
$url = "https://devapi.qweather.com/v7/weather/now?location=你的城市&key=你自己的&gzip=n";
$data = get_request($url);
echo $data;

function get_request($url)
{
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($curl, CURLOPT_ENCODING, "gzip"); // 添加此行以支持 gzip 解压缩
    $output = curl_exec($curl);
    curl_close($curl);
    return $output;
}
?>